﻿<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>初中数学知识图谱及应用</title>

    <!--Bootstrap Stylesheet [ REQUIRED ]-->
    <link href="../static/css/bootstrap.min.css" rel="stylesheet">

    <link rel="shortcut icon" href="../static/images/logo.jpg">
    <!--Nifty Stylesheet [ REQUIRED ]-->
    <link href="../static/css/nifty.min.css" rel="stylesheet">


    <!--Nifty Premium Icon [ DEMONSTRATION ]-->
    <link href="../static/css/nifty-demo-icons.min.css" rel="stylesheet">


    <!--Demo [ DEMONSTRATION ]-->
    <link href="../static/css/nifty-demo-icons.min.css" rel="stylesheet">
    <link href="../static/css/nifty-demo.min.css" rel="stylesheet">
    <link href="../static/css/font-awesome.min.css" rel="stylesheet">



    <!--JAVASCRIPT-->
    <!--=================================================-->

    <!--Pace - Page Load Progress Par [OPTIONAL]-->
    <link href="../static/css/pace.min.css" rel="stylesheet">

    <script src="../static/js/pace.min.js"></script>


    <!--jQuery [ REQUIRED ]-->
    <script src="../static/js/jquery-2.2.4.min.js"></script>


    <!--BootstrapJS [ RECOMMENDED ]-->
    <script src="../static/js/bootstrap.min.js"></script>


    <!--NiftyJS [ RECOMMENDED ]-->
    <script src="../static/js/nifty.min.js"></script>
    <script src="../static/js/icons.js"></script>
    <script src="../static/js/echarts.min.js"></script>
    <script src="../static/js/tags.js"></script>



    <!--=================================================-->

    <!--Demo script [ DEMONSTRATION ]-->
    <script src="../static/js/nifty-demo.min.js"></script>
    <style type="text/css">
    #tagsList {position:relative; width:250px; height:250px; }
#tagsList a {position:absolute; top:0px; left:0px; font-family: Microsoft YaHei; color:gray; font-weight:bold; text-decoration:none; padding: 3px 6px; }
#tagsList a:hover { color:#249e92; letter-spacing:2px;}
#search:focus{
    border: 1px solid #249e92;
}
    </style>

</head>

<body>

    <div id="container" class="effect aside-float aside-bright mainnav-lg">

        <!--NAVBAR-->
        <!--===================================================-->
        <header id="navbar">
            <div id="navbar-container" class="boxed">

                <!--Brand logo & name-->
                <!--================================-->
                <div class="navbar-header">
                    <a href="{{ url_for('index') }}" class="navbar-brand">
                        <img src="../static/images/logo.jpg" alt="Nifty Logo" class="brand-icon">
                        <div class="brand-title">
                            <span class="brand-text"></span>
                        </div>
                    </a>
                </div>
                <!--================================-->
                <!--End brand logo & name-->


                <!--Navbar Dropdown-->
                <!--================================-->
                <div class="navbar-content clearfix">
                    <ul class="nav navbar-top-links pull-left">

                        <!--Navigation toogle button-->
                        <!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
                        <li class="tgl-menu-btn">
                            <a class="mainnav-toggle" href="#">
                                <i class="demo-pli-view-list"></i>
                            </a>
                        </li>

                    </ul>
                    <ul class="nav navbar-top-links pull-left">

                        <h4>初中数学知识图谱及应用</h4>






                    </ul>
                </div>
                <!--================================-->
                <!--End Navbar Dropdown-->

            </div>
        </header>
        <!--===================================================-->
        <!--END NAVBAR-->

        <div class="boxed">

            <!--CONTENT CONTAINER-->
            <!--===================================================-->
            <div id="content-container">

                <!--Page content-->
                <!--===================================================-->
                <div id="page-content">

					<h4 class="text-main pad-btm bord-btm">知识关系可视化</h4>

              <div class="row">


                <div class="col-lg-6">


                    </div>
                    <div class="col-lg-2"></div>
                    <div class="col-lg-4">
                        <div class="input-group" >
                            <input type="text" id="search" class="form-control input-lg"  placeholder="请输入你要检索的名字...">
                            <span class="input-group-addon btn btn-mint"  onclick="search()">搜索</span>

                        </div>
                    </div>

                    </div>
                    <div class="row" style="height: 40px;"></div>
                     <div class="row" >
                        <div class="col-lg-8" style="height: 90vh;margin-top: -80px;" id="guanxi">


                    </div>

                    <div class="col-lg-2"></div>
                    <div  class="col-lg-4" id="tagsList" style="margin-left: 70px;">
                    <a href="#" data="平方根" >平方根</a>
                    <a href="#" data="矩形">矩形</a>
                    <a href="#" data="命题">命题</a>
                    <a href="#" data="质数">质数</a>
                    <a href="#" data="曲线">曲线</a>
                    <a href="#" data="坐标">坐标</a>
                    <a href="#" data="概率分布">概率分布</a>
                    <a href="#" data="交集">交集</a>
                    <a href="#" data="样本空间">样本空间</a>
                    <a href="#" data="联立方程">联立方程</a>
                    <a href="#" data="对数">对数</a>
                    <a href="#" data="圆周率">圆周率</a>
                    <a href="#" data="数列">数列</a>
                    <a href="#" data="单位圆">单位圆</a>
                    <a href="#" data="截距">截距</a>
                    <a href="#" data="等式">等式</a>
                    <a href="#" data="负数">负数</a>
                    <a href="#" data="正整数">正整数</a>
                    <a href="#" data="加法公式">加法公式</a>
                    </div>
                    </div>

                </div>
                <!--===================================================-->
                <!--End page content-->


            </div>
            <!--===================================================-->
            <!--END CONTENT CONTAINER-->


            <!--MAIN NAVIGATION-->
            <!--===================================================-->
            <nav id="mainnav-container">
                <div id="mainnav">

                    <!--Menu-->
                    <!--================================-->
                    <div id="mainnav-menu-wrap">
                        <div class="nano">
                            <div class="nano-content">

                                <ul id="mainnav-menu" class="list-group">



                                    <!--Category name-->
						            <li class="list-header"> 知识关系可视化</li>

                                    <!--Menu list item-->


                                    <!--Menu list item-->
                                   <li>
                                        <a href="{{ url_for('search') }}">
                                            <i class="fa fa-search" style="width:24px"></i>
                                            <span class="menu-title">
                                                <strong>检索知识关系</strong>
                                            </span>

                                        </a>


                                    </li>
                                    <li>
                                        <a href="{{ url_for('get_all_relation') }}">
                                            <i class="fa fa-pie-chart" style="width:24px"></i>
                                            <span class="menu-title">
                                                <strong>知识关系全貌</strong>
                                            </span>

                                        </a>

                                    </li>
                                    <!--Menu list item-->



						            <li class="list-divider"></li>

						            <!--Category name-->
<!--						            <li class="list-header">问答系统</li>-->

						            <!--Menu list item-->
<!--						            <li >-->
<!--						                <a href="{{ url_for('KGQA') }}">-->
<!--						                    <i class="fa fa-question-circle" style="width:24px"></i>-->
<!--						                    <span class="menu-title">人物关系问答</span>-->

<!--						                </a>-->


<!--						            </li>-->

						                                    </ul>



                            </div>
                        </div>
                    </div>
                    <!--================================-->
                    <!--End menu-->

                </div>
            </nav>
            <!--===================================================-->
            <!--END MAIN NAVIGATION-->

        </div>

        <!-- FOOTER -->
        <!--===================================================-->
        <footer id="footer">

           <p class="pad-lft">Copyright&#0169; 2022 &nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;All Rights Reserved </p>

        </footer>
        <!--===================================================-->
        <!-- END FOOTER -->

        <!-- SCROLL PAGE BUTTON -->
        <!--===================================================-->
        <button class="scroll-top btn">
            <i class="pci-chevron chevron-up"></i>
        </button>
        <!--===================================================-->
    </div>
    <!--===================================================-->
    <!-- END OF CONTAINER -->
   <script type="text/javascript">
    $(document).keypress(function (e) {
        // 回车键事件
        if (e.which == 13) {
            search();
        }
    });
    window.onresize = function () {

        myChart.resize();
    }

    $.ajaxSetup({ async: false });
    var myChart = echarts.init(document.getElementById("guanxi"));
    myChart.showLoading();

    myChart.hideLoading();
    option = {
        // backgroundColor: "white",
        title: {
            // text: '水浒传人物关系图',
            textStyle: {
                // color: "white",
                fontWeight: "lighter",
            }
        },
        animationDurationUpdate: 1500,
        animationEasingUpdate: 'quinticInOut',
        legend: {
            x: "center",
            // y : 500,
            show: true,
            // data: ["天罡", "地煞", "朝廷", "祝家庄", "曾头市", "大名府", "其他","天大"]
            data: ["基础概念", "几何学", "函数方程", "概率统计", "代数", "解析几何", "高等数学", "逻辑证明"]
        },
        series: [
            {
                type: 'graph',
                layout: 'force',
                symbolSize: 50,
                edgeSymbol: ['circle', 'arrow'],
                edgeSymbolSize: [4, 4],
                edgeLabel: {
                    normal: {
                        show: true,
                        textStyle: {
                            fontSize: 10
                        },
                        formatter: "{c}"
                    }
                },
                force: {
                    repulsion: 2500,
                    edgeLength: [10, 100]
                },
                focusNodeAdjacency: true,
                draggable: true,
                roam: true,
                categories: [{
                    name: '基础概念',
                    // itemStyle: {
                    //     normal: {
                    //         color: "#009800",
                    //     }
                    // }
                }, {
                    name: '几何学',
                    // itemStyle: {
                    //     normal: {
                    //         color: "#4592FF",
                    //     }
                    // }
                }, {
                    name: '函数方程',
                    // itemStyle: {
                    //     normal: {
                    //         color: "#3592F",
                    //     }
                    // }
                },
                    {
                        name: '概率统计',
                    }, {
                        name: '代数',
                    }, {
                        name: '解析几何',
                    },
                    {
                        name: '高等数学',
                    },
                    {
                        name: '逻辑证明',
                    }
                ],
                label: {
                    normal: {
                        show: true,
                        textStyle: {
                            fontSize: 10
                        },
                    }
                },
                force: {
                    repulsion: 1000
                },
                tooltip: {
                    formatter: function (node) { // 区分连线和节点，节点上额外显示其他数字
                        if (!node.value) {
                            return node.data.name;
                        } else {
                            return node.data.name + ":" + node.data.showNum;
                        }
                    },
                },
                lineStyle: {
                    normal: {
                        opacity: 0.9,
                        width: 1,
                        curveness: 0.3
                    }
                },
                // progressiveThreshold: 700,
                nodes: [],
                links: [],



            }
        ]
    };
    function search() {

        $.getJSON('/search_name', {
            name: $("#search").val(),

        }, function (json) {

            option.series[0].nodes = json.data.map(function (node, idx) {
                node.id = idx;
                return node;
            });

            option.series[0].links = json.links;

            myChart.setOption(option, true);

        });
    }

    $(".col-lg-4 a").click(function () {

        $.getJSON('/search_name', {
            name: $(this).attr("data"),

        }, function (json) {

            option.series[0].nodes = json.data.map(function (node, idx) {
                node.id = idx;
                return node;
            });

            option.series[0].links = json.links;

            myChart.setOption(option, true);

        })
    });
</script>
</body>
</html>
